package com.lulalei.dbviewer.db;

import com.lulalei.dbviewer.commons.bean.TableBean;
import com.lulalei.dbviewer.commons.exception.CustomizeException;
import com.lulalei.dbviewer.db.mysql.DTO.TableAndColumnsQueryDTO;
import com.lulalei.dbviewer.dto.DBConnectDTO;
import com.lulalei.dbviewer.dto.DBTablesInfoDTO;
import com.lulalei.dbviewer.vo.PageVO;

import java.sql.SQLException;
import java.util.List;

public interface DBService {

    /**
     * 测试连接
     * @param connectDTO 数据库的相关参数
     * @return 成功或失败
     */
    boolean connect(DBConnectDTO connectDTO) throws CustomizeException, SQLException;

    /**
     * 获取所有的表信息
     */
    PageVO<TableBean> getTableInfo(DBTablesInfoDTO dbTablesInfoDTO) throws CustomizeException, SQLException;

    /**
     * 获取所有表和字段信息
     */
    List<TableBean> getTableAndField(TableAndColumnsQueryDTO queryDTO) throws CustomizeException, SQLException;

    boolean isOwn(String type);
}
